package cn.xd.itstack.springframework.core.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * @Classname FilePathResource
 * @Description TODO
 * @Date 2022/5/16 上午11:35
 * @Created by lvxiaodong
 */
public class FileResource implements Resource {

    private String path;

    private File file;


    public FileResource(File file){
            this.file = file;
            this.path = file.getPath();
    }


    public FileResource(String path){
        this.file = new File(path);
        this.path = path;
    }


    @Override
    public InputStream getInputStream() throws IOException {
        return new FileInputStream(this.file);
    }
}
